package com.yy.train.ticket.train.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import com.yy.train.ticket.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.yy.train.ticket.train.entity.TtLineLinkEntity;
import com.yy.train.ticket.train.service.TtLineLinkService;




/**
 * 线路链
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2023-10-18 17:53:49
 */
@RestController
@RequestMapping("tt/linelink")
public class TtLineLinkController {
    @Autowired
    private TtLineLinkService ttLineLinkService;

    /**
     * 列表
     */
    @RequestMapping("/list/{lineId}")
    public R list(@PathVariable("lineId") Long lineId){
        return  ttLineLinkService.linelinklist(lineId);


    }


    /**
     * 信息
     */
    @RequestMapping("/info/{linkId}")
    public R info(@PathVariable("linkId") Long linkId){
		TtLineLinkEntity ttLineLink = ttLineLinkService.getById(linkId);

        return R.ok().put("ttLineLink", ttLineLink);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody TtLineLinkEntity ttLineLink){
        return	ttLineLinkService.assemble(ttLineLink);
    }



    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody TtLineLinkEntity ttLineLink){
		ttLineLinkService.updateById(ttLineLink);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody List<Long> linkIds){
        return ttLineLinkService.deleteLineLinkByIds(linkIds);


    }

}
